const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
// const userRouter = require('../router/user.router');
// const authRouter = require('../router/auth.router');
const userRouter = require('../router/index');

const {
    errorHandle
} = require('./error_handle');     //导入错误信息处理文件模块


const app = new Koa();

app.use(bodyParser());


// app.use(userRouter.routes());
// app.use(userRouter.allowedMethods());
// app.use(authRouter.routes());
// app.use(authRouter.allowedMethods());


// userRouter(app);
app.userRouter = userRouter;
app.userRouter();


app.on('error', errorHandle);     //App监听错误事件

module.exports= app;
